package cn.edu.hpu.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import cn.edu.hpu.pojo.Group;
import cn.edu.hpu.service.GroupService;

import com.opensymphony.xwork2.ActionSupport;

public class GroupAction extends ActionSupport{

	private static final long serialVersionUID = 1L;

	private Group group;
	private GroupService groupService;
	private List<Group> glist;
	private String id;
	
	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}
	public String groupmessage(){
		glist = groupService.findAll();
		return SUCCESS;
	}
	public String savegroup(){
		groupService.save(group);
		return SUCCESS;
	}
	public String groupdelete(){
		groupService.delete(id);
		return SUCCESS;
	}
	public String groupupdate(){
		group = groupService.findA(id);
		return SUCCESS;
	}
	public String updategroup(){
		groupService.update(group);
		return SUCCESS;
	}
	
	
	
	
	
	//setter,getter
	public Group getGroup() {
		return group;
	}
	public void setGroup(Group group) {
		this.group = group;
	}
	public GroupService getGroupService() {
		return groupService;
	}
	@Autowired
	public void setGroupService(GroupService groupService) {
		this.groupService = groupService;
	}
	public List<Group> getGlist() {
		return glist;
	}
	public void setGlist(List<Group> glist) {
		this.glist = glist;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	
}
